package controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import service.ContentService;
import util.MessageUtil;
import util.ReturnResultUtil;
import view.QueryView;

/**
 * Created by gable on 2018/5/23.
 */
@Controller
public class ContentController {

    @Autowired
    ContentService contentService;

    /**
     * @Author: 杨青桦
     * @Description:  人员编制查询接口
     * @Date: 2018/5/23 16:04
     * @param queryView
     * @return
     */
    @RequestMapping(value = "/manning-quotas",method = RequestMethod.POST)
    @ResponseBody
    public ReturnResultUtil queryManningQuotas(QueryView queryView){
        try {
            return contentService.queryManningQuotas(queryView);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return new ReturnResultUtil(0, MessageUtil.ERROR);
    }

    /**
     * @Author: 杨青桦
     * @Description:  人员绩效查询接口
     * @Date: 2018/5/23 16:04
     * @param queryView
     * @return
     */
    @RequestMapping(value = "/personnel-performance",method = RequestMethod.POST)
    @ResponseBody
    public ReturnResultUtil queryPersonnelPerformance(QueryView queryView){
        try {
            return contentService.queryPersonnelPerformance(queryView);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return new ReturnResultUtil(0, MessageUtil.ERROR);
    }


    /**
     * @Author: 杨青桦
     * @Description:  收支情况查询接口
     * @Date: 2018/5/23 16:04
     * @param queryView
     * @return
     */
    @RequestMapping(value = "/medical-balance",method = RequestMethod.POST)
    @ResponseBody
    public ReturnResultUtil queryMedicalBalance(QueryView queryView){
        try {
            return contentService.queryMedicalBalance(queryView);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return new ReturnResultUtil(0, MessageUtil.ERROR);
    }


    /**
     * @Author: 杨青桦
     * @Description:  运行保障查询接口
     * @Date: 2018/5/23 16:04
     * @param queryView
     * @return
     */
    @RequestMapping(value = "/running-guarantee",method = RequestMethod.POST)
    @ResponseBody
    public ReturnResultUtil queryRunningGuarantee(QueryView queryView){
        try {
            return contentService.queryRunningGuarantee(queryView);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return new ReturnResultUtil(0, MessageUtil.ERROR);
    }


    /**
     * @Author: 杨青桦
     * @Description:  计生服务查询接口
     * @Date: 2018/5/23 16:04
     * @param queryView
     * @return
     */
    @RequestMapping(value = "/family-plan",method = RequestMethod.POST)
    @ResponseBody
    public ReturnResultUtil queryFamilyPlan(QueryView queryView){
        try {
            return contentService.queryFamilyPlan(queryView);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return new ReturnResultUtil(0, MessageUtil.ERROR);
    }


    /**
     * @Author: 杨青桦
     * @Description:  医疗业务查询接口
     * @Date: 2018/5/23 16:04
     * @param queryView
     * @return
     */
    @RequestMapping(value = "/medical-business",method = RequestMethod.POST)
    @ResponseBody
    public ReturnResultUtil queryMedicalBusiness(QueryView queryView){
        try {
            return contentService.queryMedicalBusiness(queryView);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return new ReturnResultUtil(0, MessageUtil.ERROR);
    }


    /**
     * @Author: 杨青桦
     * @Description:  全科医生查询接口
     * @Date: 2018/5/23 16:04
     * @param queryView
     * @return
     */
    @RequestMapping(value = "/general",method = RequestMethod.POST)
    @ResponseBody
    public ReturnResultUtil queryGeneral(QueryView queryView){
        try {
            return contentService.queryGeneral(queryView);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return new ReturnResultUtil(0, MessageUtil.ERROR);
    }

    /**
     * @Author: mj
     * @Description:  三项核心指标接口
     * @param queryView
     * @return
     */
    @RequestMapping(value = "/queryThreeCore",method = RequestMethod.POST)
    @ResponseBody
    public ReturnResultUtil queryThreeCore(QueryView queryView){
        try {
            return contentService.queryThreeCore(queryView);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return new ReturnResultUtil(0, MessageUtil.ERROR);
    }

    /**
     * @Author: mj
     * @Description:  医疗收入同期比
     * @param queryView
     * @return
     */
    @RequestMapping(value = "/queryMedicalIncomeRate",method = RequestMethod.POST)
    @ResponseBody
    public ReturnResultUtil queryMedicalIncomeRate(QueryView queryView){
        try {
            return contentService.queryMedicalIncomeRate(queryView);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return new ReturnResultUtil(0, MessageUtil.ERROR);
    }

    /**
     * @Author: mj
     * @Description:  药品收入同期比
     * @param queryView
     * @return
     */
    @RequestMapping(value = "/queryDrugsIncomeRate",method = RequestMethod.POST)
    @ResponseBody
    public ReturnResultUtil queryDrugsIncomeRate(QueryView queryView){
        try {
            return contentService.queryDrugsIncomeRate(queryView);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return new ReturnResultUtil(0, MessageUtil.ERROR);
    }
}
